package com.yenlien.traceyun.usercenter.entity;

import com.yenlien.traceyun.webase.entity.BaseEntity;

import javax.persistence.*;
import java.util.List;

/**
 * 资resource incloud menu and resource
 */

@Entity
@Table(name = "t_resource")
public class Resource extends BaseEntity {


    //所属appid
    @Column(name = "app_id", length = 32)
    private String appId;

    public enum ResourceType {
        MENU,//菜单
        FUNC//功能
    }

    //名称
    @Column(name = "name", length = 50)
    private String name;

    //url
    @Column(name = "url", length = 255)
    private String url;

    //路由
    @Column(name = "router", length = 50)
    private String router;

    //icon
    @Column(name = "icon", length = 50)
    private String icon;

    //排序
    @Column(name = "sort_num", length = 2)
    private int sortNum;

    //资源类型
    @Column(name = "resource_type", length = 6)
    @Enumerated(EnumType.STRING)
    private ResourceType type;

    // 父id
    @Column(name = "parent_id", length = 32)
    private String parentId;

    //是否系统设置
    @Column(name = "config_menu")
    private boolean configMenu;

    // 给德格的菜单加上藏文
    private String tibetName;

    @Transient
    private List<Resource> children;

    public List<Resource> getChildren() {
        return children;
    }

    public void setChildren(List<Resource> children) {
        this.children = children;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getIcon() {
        return icon;
    }

    public void setIcon(String icon) {
        this.icon = icon;
    }

    public int getSortNum() {
        return sortNum;
    }

    public void setSortNum(int sortNum) {
        this.sortNum = sortNum;
    }

    public ResourceType getType() {
        return type;
    }

    public void setType(ResourceType type) {
        this.type = type;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getParentId() {
        return parentId;
    }

    public void setParentId(String parentId) {
        this.parentId = parentId;
    }

    public String getAppId() {
        return appId;
    }

    public void setAppId(String appId) {
        this.appId = appId;
    }

    public String getTibetName() {
        return tibetName;
    }

    public void setTibetName(String tibetName) {
        this.tibetName = tibetName;
    }

    public String getRouter() {
        return router;
    }

    public void setRouter(String router) {
        this.router = router;
    }

    public boolean isConfigMenu() {
        return configMenu;
    }

    public void setConfigMenu(boolean configMenu) {
        this.configMenu = configMenu;
    }
}
